package backend.majiong.yaku.yaku;

import java.util.ArrayList;
import java.util.List;

import backend.MainGame;
import backend.majiong.Pai;
import backend.majiong.Player;
import backend.majiong.yaku.AbstractYaku;
import backend.majiong.yaku.HandCombo;


public class Ipeikou extends AbstractYaku {

    @Override
    public boolean checkYaku(Player player, HandCombo combo, MainGame mainGame) {
        if (!combo.getIsMengQing()) {
            return false;
        }
        List<Pai> list = combo.getSunZi();
        List<Pai> checkList = new ArrayList<Pai>();
        for(Pai pai:list) {
            if(checkList.contains(pai)) {
                return true;
            } else {
                checkList.add(pai);
            }
        }
        return false;
    }

    @Override
    public String getYakuName() {
        return "一杯口";
    }

    @Override
    public Integer getYakuNum(boolean isMenQing) {
        return 1;
    }

}
